(function () {
	var linkObj = {
		国家基本气象站: '/v5/cbs/',
		自动站: 'http://10.153.96.34/smproductv3/autosite/index.jsp',
		区域自动站: '/observe/autosite/',
		站点比对: 'http://10.153.96.34/smproductv3/autosite2/',
		区域监测一张图: '/observe/autosite_map/',
		多要素查看: '/observe/autosite_ts/',
		降水专题监测: '/observe/weather/',
		城市气候站: 'http://10.153.96.34/smproductv3/env/env2.jsp',
		基本站: 'http://10.153.96.34/smproductv3/country/index2.jsp',
		'能见度/雾霾': 'http://10.153.96.34/smproductv3/visibility/map/',
		城市气象立体观测: '/observe/skyline/',
		香港垂直探空观测: '/observe/hk_vertical/',
		风廓线雷达: '/observe/windprofile/',
		风廓线雷达系统: 'http://10.153.96.75:86/',
		// 'GPS/MET': 'http://10.153.96.34/smproduct/gpsmet2/',
		气象梯度塔: 'http://10.153.96.33/tiduta/#/home',
		微波辐射计: '/observe/microwave/',
		激光云高仪: '/observe/cloudh/',
		// 雨滴谱: 'http://10.153.96.34/smraindrop/addindex.shtml',
		闪电定位: 'http://10.153.97.139/thunder/',
		人体舒适度: '/observe/comfort/',
		回南天: 'http://10.153.96.33/obserinte/#/south',
		// 大气电场仪: 'http://10.153.96.34/smproductv3/sd/',
		// 沙温: 'http://10.153.96.34/smproduct/sandt/',
		天气实景: 'http://10.153.96.106/#/',
		太阳辐射: 'http://10.153.96.33:81/smsun2/',
		// 多下垫面: 'http://10.153.96.34/smquery/bin/product/monitor/underlying/index.html',
		温室气体: 'http://10.153.96.33:81/greenhousegases/',
		// 紫外辐射: 'http://10.153.96.34/smproductv3/uv/',
		// 土壤湿度: 'http://10.153.96.34/smproduct/env/env_turang40.jsp',
		大气成分: '/observe/acogg/',
		// 体感温度: 'http://10.153.96.34/smproductv4/comfort/',
		X波段雷达: '/observe/radar/',
		海洋气象监测平台: 'http://10.153.96.33:5001/seamonitor/home/index.html',
		海洋实况监测: '/observe/sea_map/',
		海洋监测: '/observe/sea_ts/',
		海洋气象廓线: '/observe/seaprofile/',
		海雾监测: '/observe/sea_fog/',
		楼宇大风: 'http://10.153.96.109:8015/Page/3DGeographicForm.aspx',
		智慧杆布局: '/observe/smartbar/',
		秒级观测: '/observe/second/',
		生态观测: '/v5/ecology/',
		温室气体观测: '/observe/social/',
		// 大城市综合实验: 'http://10.153.97.35:6010/Observation.aspx',
		深圳湾: '/observe/nationalday/',
		前海湾: '/observe/foresea/',
		赛格广场: '/observe/saige_plaza/',
		// 智慧城市气象观测试验系统: 'http://10.153.101.2/home',
		探测设备布局: '/observe/equipment_layout/',
		'探测设备布局(new)': '/observe/equipment_new/',
		雷达探测布局: '/observe/radar_layout/',
		三维精细化网格数据子系统:
			'http://10.153.96.111:8097/Pages/Home/Home.html?target=ProductNcar&v=20210421173609',
		台风风雨影响: 'http://10.153.97.11:81/typhoon/main.jsp',
		实时滚动灰霾监测: 'http://10.153.96.34/smquery/bin/product/vu.jsp',
		// 台风高温预报: 'http://10.153.96.34/smportal/showproxypage.do?url=/smproductv3/htemp/',
		实时滑动雨量极值: 'http://10.153.96.34/smquery/bin/product/huadongrain.jsp',
		// 霾天数: 'http://10.153.96.34/smportal/showproxypage.do?url=/smproductv3/haze',
		// 寒冷天数持续时长: 'http://10.153.96.34/smquery/bin/product/coldair.jsp',
	};

	var moduleJsonArr = [
		{
			name: '首页',
			link: '/observe/home/',
			dataValue: 'home',
		},
		{
			name: '地面观测',
			dataValue: 'ground-monitor',
		},
		{
			name: '垂直观测',
			dataValue: 'vertical-monitor',
		},
		{
			name: '特种观测',
			dataValue: 'special-monitor',
		},
		{
			name: '海洋观测',
			dataValue: 'sea-monitor',
		},
		// {
		//   name: '网格实况',
		//   dataValue: 'grid-monitor',
		// },
		{
			name: '社会化观测',
			// name: '社会化观测与创新',
			dataValue: 'socialization-monitor',
		},
		{
			name: '观测设备布局',
			dataValue: 'equip-monitor',
		},
		// {
		//   name: '统计应用',
		//   dataValue: 'total-monitor',
		// },
		{
			name: '观测台账与规划',
			link: '/observe/accounting/',
		},
		{
			name: '智能观测平台',
			// name: '智能观测一体化平台',
			link: 'http://10.153.96.33/obserinte/#/Apicture',
		},
	];

	var header = document.createElement('div');

	// 获取当前脚本的路径
	var scripts = document.getElementsByTagName('script');
	var currentScript = scripts[scripts.length - 1];
	var scriptPath = currentScript.src;
	var basePath = scriptPath.substring(0, scriptPath.lastIndexOf('/') + 1);

	var favLink = document.createElement('link');
	favLink.setAttribute('rel', 'icon');
	favLink.setAttribute('href', './src/assets/header/image/favicon.ico');
	favLink.setAttribute('type', 'image/x-icon');
	header.appendChild(favLink);

	var shortLink = document.createElement('link');
	shortLink.setAttribute('rel', 'shortcut icon');
	shortLink.setAttribute('href', './src/assets/header/image/favicon.ico');
	shortLink.setAttribute('type', 'image/x-icon');
	header.appendChild(shortLink);

	var firstScript = document.createElement('script');
	// firstScript.setAttribute('src', '../assets/js/jquery.min.js');
	firstScript.setAttribute('type', 'text/javascript');
	firstScript.setAttribute('charset', 'utf-8');
	header.appendChild(firstScript);
	/*var secScript = document.createElement("script");
    secScript.setAttribute("src", "../assets/js/header/js/header-js.js");
    secScript.setAttribute("type", "text/javascript");
    secScript.setAttribute("charset", "utf-8");
    header.appendChild(secScript);*/

	//整体headerdiv
	var headerDiv = document.createElement('div');
	headerDiv.setAttribute('class', 'header');

	//上半部分
	var upDiv = document.createElement('div');
	upDiv.setAttribute('class', 'header-up');

	//
	var upAllDiv = document.createElement('div');
	upAllDiv.setAttribute('class', 'up-letter');

	var imgLogo = document.createElement('img');
	imgLogo.setAttribute('class', 'img-logo');
	imgLogo.setAttribute('src', './src/assets/header/image/new-logo.png');
	upAllDiv.appendChild(imgLogo);

	var contentDIv = document.createElement('div');
	contentDIv.setAttribute('class', 'all-letter');

	var chDiv = document.createElement('div');
	chDiv.innerText = '深圳陆海一体精密监测平台2.0';
	chDiv.setAttribute('class', 'ch-span');
	contentDIv.appendChild(chDiv);
	var enDiv = document.createElement('div');
	enDiv.innerText = 'SHENZHEN INTEGRATED LAND-SEA PRECISION MONITORING PLATFORM 2.0';
	enDiv.setAttribute('class', 'en-span');

	contentDIv.appendChild(enDiv);
	upAllDiv.appendChild(contentDIv);

	upDiv.appendChild(upAllDiv);
	headerDiv.appendChild(upDiv);

	//下半部分
	var downDiv = document.createElement('div');
	downDiv.setAttribute('class', 'header-down');

	var tabAllDiv = document.createElement('div');
	tabAllDiv.setAttribute('class', 'tabs h-100');

	for (var i = 0; i < moduleJsonArr.length; i++) {
		var moduleJson = moduleJsonArr[i];
		var tabDiv = document.createElement('div');
		if (moduleJson.link) {
			tabDiv = document.createElement('a');
			tabDiv.setAttribute('href', moduleJson.link);
			moduleJson.dataValue ? tabDiv.setAttribute('value', moduleJson.dataValue) : '';
		} else {
			moduleJson.dataValue ? tabDiv.setAttribute('data-value', moduleJson.dataValue) : '';
		}

		tabDiv.setAttribute('class', 'tab h-100');
		moduleJson.dataValue ? tabDiv.setAttribute('data-value', moduleJson.dataValue) : '';
		moduleJson.open ? tabDiv.setAttribute('target', moduleJson.open) : '';
		tabDiv.innerText = moduleJson.name;
		if (moduleJson.children != undefined) {
			childJson = moduleJson.children;
			var ul = document.createElement('ul');
			for (var j = 0; j < childJson.length; j++) {
				var li = document.createElement('li');
				li.innerText = childJson[j].name;
				li.setAttribute('href', childJson[j].link);
				li.setAttribute('data-value', childJson[j].dataValue);
				li.setAttribute('target', childJson[j].open);
				ul.appendChild(li);
			}
			tabDiv.appendChild(ul);
		}
		tabAllDiv.appendChild(tabDiv);
	}

	//首页
	createHomeTab();

	//地面观测
	createGroundTab();

	//垂直观测
	createVerticalTab();

	//特种观测
	createSpecialTab();

	//海洋观测
	createSeaTab();

	//网格实况
	createGridTab();

	//社会化观测与创新
	createSocializationTab();

	//观测设备布局
	createEquipTab();

	//统计应用
	createTotalTab();

	downDiv.appendChild(tabAllDiv);
	headerDiv.appendChild(downDiv);
	header.appendChild(headerDiv);

	document.write(header.innerHTML);

	window.onload = function () {
		// resizeBodyHeight();
		var localUrl = window.location.href;
		var index = localUrl.indexOf('/observe/');
		if (-1 == index) {
			console.log('路径中不包含/observe/，无法激活标题栏');
			return;
		}
		/*var tempUrl = localUrl.substr(index + 9);
        var tempIndex = tempUrl.indexOf("/");
        var name = tempUrl.substr(0, tempIndex);*/

		var pathEle = $("a[href='" + location.pathname + "']");
		var name = pathEle.attr('value');
		$('[data-value=' + name + ']').addClass('active');
		$("a[href='" + location.pathname + "']").addClass('active');

		// $('[data-value=' + name + ']').addClass("active");
		// $("a[href='" + location.pathname + "']").addClass("active");
		// var parentEle = $('[data-value=' + name + ']').parent().parent();
		// parentEle.hasClass("tab") ? parentEle.addClass("active") : "";

		initEvent();
	};

	function createHomeTab() {
		var navJsonArr = [
			{
				name: '地面观测',
				class: 'ground',
				dataValue: 'ground-monitor',
				children: [
					{
						name: '国家基本气象站',
						open: '_blank',
						link: linkObj['国家基本气象站'],
					},
					// {
					//   name: '自动站',
					//   open: '_blank',
					//   link: linkObj['自动站'],
					//   type: '时序图',
					// },
					{
						name: '区域自动站',
						open: '_self',
						link: linkObj['区域自动站'],
						// type: '预报'
					},
					// {
					//   name: '站点比对',
					//   open: '_blank',
					//   link: linkObj['站点比对'],
					//   type: '时序图',
					// },
					{
						name: '区域监测一张图',
						open: '_self',
						link: linkObj['区域监测一张图'],
						// type: '观测'
					},
					{
						name: '多要素查看',
						open: '_self',
						link: linkObj['多要素查看'],
						type: '时序图',
					},
					{
						name: '降水专题监测',
						open: '_blank',
						link: linkObj['降水专题监测'],
					},
					// {
					//   name: '城市气候站',
					//   open: '_blank',
					//   link: linkObj['城市气候站'],
					//   type: '时序图',
					// },
					// {
					//   name: '基本站',
					//   open: '_blank',
					//   link: linkObj['基本站'],
					//   type: '时序图',
					// },
					// {
					//   name: '能见度/雾霾',
					//   open: '_blank',
					//   link: linkObj['能见度/雾霾'],
					//   type: '时序图',
					// },
				],
			},
			{
				name: '垂直观测',
				class: 'ground',
				dataValue: 'vertical-monitor',
				children: [
					{
						name: '城市气象立体观测',
						open: '_self',
						link: linkObj['城市气象立体观测'],
					},
					{
						name: '香港垂直探空观测',
						open: '_self',
						link: linkObj['香港垂直探空观测'],
					},
					{
						name: '风廓线雷达系统',
						open: '_self',
						link: linkObj['风廓线雷达系统'],
					},
					{
						name: '风廓线雷达',
						open: '_self',
						link: linkObj['风廓线雷达'],
					},
					// {
					//   name: 'GPS/MET',
					//   open: '_blank',
					//   link: linkObj['GPS/MET'],
					// },
					{
						name: '气象梯度塔',
						open: '_blank',
						link: linkObj['气象梯度塔'],
					},
					{
						name: '微波辐射计',
						open: '_self',
						link: linkObj['微波辐射计'],
					},
					{
						name: '激光云高仪',
						open: '_self',
						link: linkObj['激光云高仪'],
					},
				],
			},
			{
				name: '特种观测',
				class: 'special',
				dataValue: 'special-monitor',
				children: [
					// {
					//   name: '雨滴谱',
					//   open: '_blank',
					//   link: linkObj['雨滴谱'],
					// },
					{
						name: '闪电定位',
						open: '_blank',
						link: linkObj['闪电定位'],
					},
					{
						name: '人体舒适度',
						open: '_self',
						link: linkObj['人体舒适度'],
					},
					{
						name: '回南天',
						open: '_blank',
						link: linkObj['回南天'],
					},
					// {
					//   name: '大气电场仪',
					//   open: '_blank',
					//   link: linkObj['大气电场仪'],
					// },
					// {
					//   name: '沙温',
					//   open: '_blank',
					//   link: linkObj['沙温'],
					// },
					{
						name: '天气实景',
						open: '_blank',
						link: linkObj['天气实景'],
					},
					{
						name: '太阳辐射',
						open: '_blank',
						link: linkObj['太阳辐射'],
					},
					// {
					//   name: '多下垫面',
					//   open: '_blank',
					//   link: linkObj['多下垫面'],
					// },
					{
						name: '温室气体',
						open: '_blank',
						link: linkObj['温室气体'],
					},
					// {
					//   name: '紫外辐射',
					//   open: '_blank',
					//   link: linkObj['紫外辐射'],
					// },
					// {
					//   name: '土壤湿度',
					//   open: '_blank',
					//   link: linkObj['土壤湿度'],
					// },
					{
						name: '大气成分',
						open: '_self',
						link: linkObj['大气成分'],
						// type: '时序图',
					},
					// {
					//   name: '体感温度',
					//   open: '_blank',
					//   link: linkObj['体感温度'],
					// },
					{
						name: 'X波段雷达',
						open: '_self',
						link: linkObj['X波段雷达'],
					},
				],
			},
			{
				name: '海洋观测',
				class: 'sea-monitor',
				dataValue: 'sea-monitor',
				children: [
					{
						name: '海洋气象监测平台',
						open: '_blank',
						link: linkObj['海洋气象监测平台'],
						// type: '预报'
					},
					{
						name: '海洋实况监测',
						open: '_self',
						link: linkObj['海洋实况监测'],
						// type: '观测'
					},
					{
						name: '海洋监测',
						open: '_self',
						link: linkObj['海洋监测'],
						type: '时序图',
					},
					{
						name: '海洋气象廓线',
						open: '_self',
						link: linkObj['海洋气象廓线'],
					},
					{
						name: '海雾监测',
						open: '_self',
						link: linkObj['海雾监测'],
					},
				],
			},
			{
				name: '社会化观测',
				// name: '社会化观测与创新',
				class: 'ground',
				dataValue: 'socialization-monitor',
				children: [
					/*{
                        name: '楼宇大风',
                        open: '_blank',
                        link: linkObj['楼宇大风'],
                    },*/
					{
						name: '智慧杆布局',
						open: '_self',
						link: linkObj['智慧杆布局'],
					},
					{
						name: '秒级观测',
						open: '_self',
						link: linkObj['秒级观测'],
					},
					{
						name: '生态观测',
						open: '_blank',
						link: linkObj['生态观测'],
					},
					{
						name: '温室气体观测',
						open: '_self',
						link: linkObj['温室气体观测'],
					},
					// {
					//   name: '大城市综合实验',
					//   open: '_blank',
					//   link: linkObj['大城市综合实验'],
					// },
					{
						name: '专题监测:',
						open: '_blank',
						children: [
							{
								name: '深圳湾',
								open: '_blank',
								link: linkObj['深圳湾'],
							},
							{
								name: '前海湾',
								open: '_blank',
								link: linkObj['前海湾'],
							},
							{
								name: '赛格广场',
								open: '_blank',
								link: linkObj['赛格广场'],
							},
						],
					},
					// {
					//   name: '智慧城市气象观测试验系统',
					//   open: '_blank',
					//   class: 'city-system',
					//   link: linkObj['智慧城市气象观测试验系统'],
					// },
				],
			},
			{
				name: '观测设备布局',
				class: 'ground',
				dataValue: 'equip-monitor',
				children: [
					{
						name: '探测设备布局',
						open: '_self',
						link: linkObj['探测设备布局'],
					},
					{
						name: '探测设备布局(new)',
						open: '_self',
						link: linkObj['探测设备布局(new)'],
					},
					{
						name: '雷达探测布局',
						open: '_self',
						link: linkObj['雷达探测布局'],
					},
				],
			},
			// {
			//   name: '网格实况',
			//   class: 'sea',
			//   dataValue: 'equip-monitor',
			//   children: [
			//     {
			//       name: '三维精细化网格数据子系统',
			//       open: '_blank',
			//       link: linkObj['三维精细化网格数据子系统'],
			//     },
			//   ],
			// },
			// {
			//   name: '统计应用',
			//   class: 'ground',
			//   dataValue: 'total-monitor',
			//   children: [
			//     {
			//       name: '台风风雨影响',
			//       open: '_blank',
			//       link: linkObj['台风风雨影响'],
			//     },
			//     {
			//       name: '实时滚动灰霾监测',
			//       open: '_blank',
			//       link: linkObj['实时滚动灰霾监测'],
			//     },
			//     // {
			//     //   name: '台风高温预报',
			//     //   open: '_blank',
			//     //   link: linkObj['台风高温预报'],
			//     // },
			//     {
			//       name: '实时滑动雨量极值',
			//       open: '_blank',
			//       link: linkObj['实时滑动雨量极值'],
			//     },
			//     // {
			//     //   name: '霾天数',
			//     //   open: '_blank',
			//     //   link: linkObj['霾天数'],
			//     // },
			//     // {
			//     //   name: '寒冷天数持续时长',
			//     //   open: '_blank',
			//     //   link: linkObj['寒冷天数持续时长'],
			//     // },
			//   ],
			// },
		];

		var navDiv = document.createElement('div');
		navDiv.setAttribute('class', 'nav-content');

		//
		var navAll = document.createElement('div');
		navAll.setAttribute('class', 'nav-all');

		for (var i = 0; i < navJsonArr.length; i++) {
			var navObj = navJsonArr[i];
			var navSingle = document.createElement('div');
			navSingle.setAttribute('class', 'single-nav');

			var titleDiv = document.createElement('div');
			titleDiv.setAttribute('class', 'single-title');
			var img = document.createElement('img');
			img.setAttribute('src', './src/assets/header/image/nav-img.png');
			titleDiv.appendChild(img);

			var spanField = document.createElement('span');
			spanField.innerText = navObj.name;
			titleDiv.appendChild(spanField);
			navSingle.appendChild(titleDiv);

			var contentDiv = document.createElement('div');
			contentDiv.setAttribute('class', 'single-content');

			var children = navObj.children;
			for (var j = 0; j < children.length; j++) {
				var childObj = children[j];
				var navTab = null;
				if (childObj.link) {
					navTab = document.createElement('a');
					navTab.setAttribute('href', childObj.link);

					navTab.setAttribute(
						'class',
						'nav-tab ' + navObj.class + (childObj.class ? ' ' + childObj.class : ''),
					);
					navTab.setAttribute('value', navObj.dataValue);
					navTab.setAttribute('target', childObj.open);
				} else {
					navTab = document.createElement('div');
					navTab.setAttribute('class', 'nav-tab project ' + navObj.class);
				}

				var tabSpan = document.createElement('span');
				tabSpan.innerText = childObj.name;
				navTab.appendChild(tabSpan);
				if (childObj.type) {
					var timeForecastDiv = document.createElement('div');
					if (childObj.type == '时序图') {
						timeForecastDiv.setAttribute('class', 'time-tu');
					} else if (childObj.type == '预报') {
						timeForecastDiv.setAttribute('class', 'forecast');
					} else if (childObj.type == '观测') {
						timeForecastDiv.setAttribute('class', 'monitor');
					}
					timeForecastDiv.innerText = childObj.type;
					navTab.appendChild(timeForecastDiv);
				}
				if (!childObj.link) {
					var grandson = childObj.children;
					for (var k = 0; k < grandson.length; k++) {
						var grandObj = grandson[k];
						var linka = document.createElement('a');
						linka.setAttribute('href', grandObj.link);
						linka.setAttribute('target', grandObj.open);
						linka.setAttribute('value', navObj.dataValue);
						linka.innerText = grandObj.name;
						navTab.appendChild(linka);
					}
				}
				contentDiv.appendChild(navTab);
			}

			navSingle.appendChild(contentDiv);

			navAll.appendChild(navSingle);
		}

		navDiv.appendChild(navAll);
		tabAllDiv.appendChild(navDiv);
	}

	function createGroundTab() {
		var groundMonitorArr = [
			{
				name: '国家基本气象站',
				open: '_blank',
				link: linkObj['国家基本气象站'],
			},
			{
				name: '区域自动站',
				open: '_self',
				link: linkObj['区域自动站'],
				// type: '预报'
			},
			// {
			//   name: '基本站',
			//   open: '_blank',
			//   link: linkObj['基本站'],
			//   type: '时序图',
			// },
			// {
			//   name: '自动站',
			//   open: '_blank',
			//   link: linkObj['自动站'],
			//   type: '时序图',
			// },
			// {
			//   name: '站点比对',
			//   open: '_blank',
			//   link: linkObj['站点比对'],
			//   type: '时序图',
			// },
			{
				name: '区域监测一张图',
				open: '_self',
				link: linkObj['区域监测一张图'],
				// type: '观测'
			},
			{
				name: '降水专题监测',
				open: '_blank',
				link: linkObj['降水专题监测'],
			},
			{
				name: '多要素查看',
				open: '_self',
				link: linkObj['多要素查看'],
				type: '时序图',
			},
			// {
			//   name: '城市气候站',
			//   open: '_blank',
			//   link: linkObj['城市气候站'],
			//   type: '时序图',
			// },
			// {
			//   name: '能见度/雾霾',
			//   open: '_blank',
			//   link: linkObj['能见度/雾霾'],
			//   type: '时序图',
			// },
		];
		createTab(groundMonitorArr, 'ground-monitor-content', tabAllDiv, 'ground-monitor');
	}

	function createVerticalTab() {
		var verticalMonitorArr = [
			{
				name: '城市气象立体观测',
				open: '_self',
				link: linkObj['城市气象立体观测'],
			},
			{
				name: '香港垂直探空观测',
				open: '_self',
				link: linkObj['香港垂直探空观测'],
			},
			{
				name: '风廓线雷达系统',
				open: '_self',
				link: linkObj['风廓线雷达系统'],
			},
			{
				name: '风廓线雷达',
				open: '_self',
				link: linkObj['风廓线雷达'],
			},
			// {
			//   name: 'GPS/MET',
			//   open: '_blank',
			//   link: linkObj['GPS/MET'],
			// },
			{
				name: '气象梯度塔',
				open: '_blank',
				link: linkObj['气象梯度塔'],
			},
			{
				name: '微波辐射计',
				open: '_self',
				link: linkObj['微波辐射计'],
			},
			// {
			//   name: '激光云高仪',
			//   open: '_self',
			//   link: linkObj['激光云高仪'],
			// },
		];
		createTab(verticalMonitorArr, 'vertical-monitor-content', tabAllDiv, 'vertical-monitor');
	}

	function createSpecialTab() {
		var specialMonitorArr = [
			// {
			//   name: '雨滴谱',
			//   open: '_blank',
			//   link: linkObj['雨滴谱'],
			// },
			{
				name: '闪电定位',
				open: '_blank',
				link: linkObj['闪电定位'],
			},
			{
				name: '人体舒适度',
				open: '_self',
				link: linkObj['人体舒适度'],
			},
			{
				name: '回南天',
				open: '_blank',
				link: linkObj['回南天'],
			},
			// {
			//   name: '大气电场仪',
			//   open: '_blank',
			//   link: linkObj['大气电场仪'],
			// },
			// {
			//   name: '沙温',
			//   open: '_blank',
			//   link: linkObj['沙温'],
			// },
			// {
			//     name: '天气实景',
			//     open: '_blank',
			//     link: linkObj['天气实景'],
			// },
			{
				name: '太阳辐射',
				open: '_blank',
				link: linkObj['太阳辐射'],
			},
			// {
			//   name: '多下垫面',
			//   open: '_blank',
			//   link: linkObj['多下垫面'],
			// },
			{
				name: '温室气体',
				open: '_blank',
				link: linkObj['温室气体'],
			},
			// {
			//   name: '紫外辐射',
			//   open: '_blank',
			//   link: linkObj['紫外辐射'],
			// },
			// {
			//   name: '土壤湿度',
			//   open: '_blank',
			//   link: linkObj['土壤湿度'],
			// },
			{
				name: '大气成分',
				open: '_self',
				link: linkObj['大气成分'],
				type: '时序图',
			},
			// {
			//   name: '体感温度',
			//   open: '_blank',
			//   link: linkObj['体感温度'],
			// },
			{
				name: 'X波段雷达',
				open: '_self',
				link: linkObj['X波段雷达'],
			},
		];
		createTab(specialMonitorArr, 'special-monitor-content', tabAllDiv, 'special-monitor');
	}

	function createSeaTab() {
		var seaMonitorArr = [
			{
				name: '海洋气象监测平台',
				open: '_blank',
				link: linkObj['海洋气象监测平台'],
				// type: '预报'
			},
			{
				name: '海洋实况监测',
				open: '_self',
				link: linkObj['海洋实况监测'],
				// type: '观测'
			},
			{
				name: '海洋监测',
				open: '_self',
				link: linkObj['海洋监测'],
				type: '时序图',
			},
			{
				name: '海洋气象廓线',
				open: '_self',
				link: linkObj['海洋气象廓线'],
			},
			{
				name: '海雾监测',
				open: '_self',
				link: linkObj['海雾监测'],
			},
		];
		createTab(seaMonitorArr, 'sea-monitor-content', tabAllDiv, 'sea-monitor');
	}

	function createGridTab() {
		var gridMonitorArr = [
			{
				name: '三维精细化网格数据子系统',
				open: '_blank',
				link: linkObj['三维精细化网格数据子系统'],
				class: 'grid-data',
			},
		];
		createTab(gridMonitorArr, 'grid-monitor-content', tabAllDiv, 'grid-monitor');
	}

	function createSocializationTab() {
		var socializationMonitorArr = [
			/*{
                name: '楼宇大风',
                open: '_blank',
                link: linkObj['楼宇大风'],
            },*/
			{
				name: '智慧杆布局',
				open: '_self',
				link: linkObj['智慧杆布局'],
			},
			{
				name: '秒级观测',
				open: '_self',
				link: linkObj['秒级观测'],
			},
			{
				name: '生态观测',
				open: '_blank',
				link: linkObj['生态观测'],
			},
			{
				name: '温室气体观测',
				open: '_self',
				link: linkObj['温室气体观测'],
			},
			// {
			//   name: '大城市综合实验',
			//   open: '_blank',
			//   link: linkObj['大城市综合实验'],
			// },
			{
				name: '专题监测:',
				open: '_blank',
				class: 'sz-fore',
				children: [
					{
						name: '深圳湾',
						open: '_blank',
						link: linkObj['深圳湾'],
					},
					{
						name: '前海湾',
						open: '_blank',
						link: linkObj['前海湾'],
					},
					{
						name: '赛格广场',
						open: '_blank',
						link: linkObj['赛格广场'],
					},
				],
			},
			// {
			//   name: '智慧城市气象观测试验',
			//   open: '_blank',
			//   link: linkObj['智慧城市气象观测试验系统'],
			// },
		];
		createTab(
			socializationMonitorArr,
			'socialization-monitor-content',
			tabAllDiv,
			'socialization-monitor',
		);
	}

	function createEquipTab() {
		var equipMonitorArr = [
			{
				name: '探测设备布局',
				open: '_self',
				link: linkObj['探测设备布局'],
			},
			{
				name: '探测设备布局(new)',
				open: '_self',
				link: linkObj['探测设备布局(new)'],
			},
			{
				name: '雷达探测布局',
				open: '_self',
				link: linkObj['雷达探测布局'],
			},
		];
		createTab(equipMonitorArr, 'equip-monitor-content', tabAllDiv, 'equip-monitor');
	}

	function createTotalTab() {
		var totalMonitorArr = [
			{
				name: '台风风雨影响',
				open: '_blank',
				link: linkObj['台风风雨影响'],
			},
			{
				name: '实时滚动灰霾监测',
				open: '_blank',
				link: linkObj['实时滚动灰霾监测'],
			},
			// {
			//   name: '台风高温预报',
			//   open: '_blank',
			//   link: linkObj['台风高温预报'],
			// },
			{
				name: '实时滑动雨量极值',
				open: '_blank',
				link: linkObj['实时滑动雨量极值'],
			},
			// {
			//   name: '霾天数',
			//   open: '_blank',
			//   link: linkObj['霾天数'],
			// },
			// {
			//   name: '寒冷天数持续时长',
			//   open: '_blank',
			//   link: linkObj['寒冷天数持续时长'],
			// },
		];
		createTab(totalMonitorArr, 'total-monitor-content', tabAllDiv, 'total-monitor');
	}

	function createTab(arr, typeClass, tabAllDiv, val) {
		var groundContent = document.createElement('div');
		groundContent.setAttribute('class', typeClass);

		var groundAll = document.createElement('div');
		groundAll.setAttribute('class', 'ground-monitor-all');

		var singleContent = document.createElement('div');
		singleContent.setAttribute('class', 'monitor-content');

		for (var i = 0; i < arr.length; i++) {
			var groundObj = arr[i];
			var otherDiv = document.createElement('div');
			if (groundObj.class) {
				otherDiv.setAttribute('class', 'other-tab ' + groundObj.class);
			} else {
				otherDiv.setAttribute('class', 'other-tab');
			}

			var navTaba = document.createElement('a');

			navTaba.setAttribute('value', val);
			if (!groundObj.link) {
				navTaba = document.createElement('div');
			} else {
				navTaba.setAttribute('href', groundObj.link);
				navTaba.setAttribute('target', groundObj.open);
			}

			navTaba.setAttribute('class', 'nav-tab');

			var spanField = document.createElement('span');
			spanField.innerText = groundObj.name;
			navTaba.appendChild(spanField);
			if (groundObj.type) {
				var divField = document.createElement('div');
				divField.innerText = groundObj.type;
				if (groundObj.type == '时序图') {
					divField.setAttribute('class', 'time-tu');
				} else if (groundObj.type == '观测') {
					divField.setAttribute('class', 'monitor');
				} else if (groundObj.type == '预报') {
					divField.setAttribute('class', 'forecast');
				}
				navTaba.appendChild(divField);
			}

			if (!groundObj.link) {
				var grandson = groundObj.children;
				for (var k = 0; k < grandson.length; k++) {
					var grandObj = grandson[k];
					var linka = document.createElement('a');
					linka.setAttribute('href', grandObj.link);
					linka.setAttribute('target', grandObj.open);
					linka.innerText = grandObj.name;
					navTaba.appendChild(linka);
				}
			}
			otherDiv.appendChild(navTaba);
			singleContent.appendChild(otherDiv);
		}

		groundAll.appendChild(singleContent);
		groundContent.appendChild(groundAll);

		tabAllDiv.appendChild(groundContent);
	}

	function resizeBodyHeight() {
		var allHeight = window.innerHeight;
		var headerHeight = $('.header').css('height');
		headerHeight = headerHeight.substr(0, headerHeight.indexOf('px'));
		var contentDiv = $('.header').next();
		contentDiv.css('overflow', 'hidden');
		contentDiv.css('overflow-y', 'scroll');
		contentDiv.css('height', allHeight - headerHeight);
	}

	function initEvent() {
		$(
			'.ground-monitor-content,.vertical-monitor-content,.special-monitor-content,.sea-monitor-content,.grid-monitor-content,.socialization-monitor-content,.equip-monitor-content,.total-monitor-content',
		).hover(
			function () {
				var content = $(this).attr('class');
				var val = content.substr(0, content.lastIndexOf('-'));
				$('div[data-value=' + val + ']').addClass('active');
			},
			function () {
				var content = $(this).attr('class');
				var val = content.substr(0, content.lastIndexOf('-'));
				$('div[data-value=' + val + ']').removeClass('active');
				var pathEle = $("a[href='" + location.pathname + "']");
				var name = pathEle.attr('value');
				$('[data-value=' + name + ']').addClass('active');
				$("a[href='" + location.pathname + "']").addClass('active');
			},
		);
	}
})();
